<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>tests/src/vfs/extfs/helpers-list/data/rpm.rewrite.sh</title>
<meta name='robots' content='noindex,nofollow' />
<meta name='generator' content='GLOBAL-6.5.7' />
<meta http-equiv='Content-Style-Type' content='text/css' />
<link rel='stylesheet' type='text/css' href='../style.css' />
</head>
<body>
<!-- beginning of fixed guide -->
<div id='guide'><ul>
<li><a href='#TOP'><img class='icon' src='../icons/first.png' alt='[^]' /></a></li>
<li><a href='#BOTTOM'><img class='icon' src='../icons/last.png' alt='[v]' /></a></li>
<li><a href='#TOP'><img class='icon' src='../icons/top.png' alt='[top]' /></a></li>
<li><a href='#BOTTOM'><img class='icon' src='../icons/bottom.png' alt='[bottom]' /></a></li>
<li><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a></li>
<li><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a></li>
<li class='standout'><span><a href='../files/tests.html'>tests</a>/<a href='../files/tests--src.html'>src</a>/<a href='../files/tests--src--vfs.html'>vfs</a>/<a href='../files/tests--src--vfs--extfs.html'>extfs</a>/<a href='../files/tests--src--vfs--extfs--helpers-list.html'>helpers-list</a>/<a href='../files/tests--src--vfs--extfs--helpers-list--data.html'>data</a>/rpm.rewrite.sh</span></li>
</ul></div>
<!-- end of fixed guide -->
<a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/tests.html'>tests</a>/<a href='../files/tests--src.html'>src</a>/<a href='../files/tests--src--vfs.html'>vfs</a>/<a href='../files/tests--src--vfs--extfs.html'>extfs</a>/<a href='../files/tests--src--vfs--extfs--helpers-list.html'>helpers-list</a>/<a href='../files/tests--src--vfs--extfs--helpers-list--data.html'>data</a>/rpm.rewrite.sh</h2>
<em class='comment'>/* <img class='icon' src='../icons/n_left.png' alt='[previous]' /><img class='icon' src='../icons/n_right.png' alt='[next]' /><img class='icon' src='../icons/n_first.png' alt='[first]' /><img class='icon' src='../icons/n_last.png' alt='[last]' /><img class='icon' src='../icons/n_top.png' alt='[top]' /><a href='#BOTTOM'><img class='icon' src='../icons/bottom.png' alt='[bottom]' /></a><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a>&nbsp;<input type='text' readonly onfocus='this.select();' value='+1 tests/src/vfs/extfs/helpers-list/data/rpm.rewrite.sh'  /> */</em>
<hr />
<pre>
<a id='L1' name='L1'></a>#
<a id='L2' name='L2'></a># This file gets source'd into our rpm helper.
<a id='L3' name='L3'></a>#
<a id='L4' name='L4'></a># It imitates the 'rpm' program by overriding a few functions.
<a id='L5' name='L5'></a>#
<a id='L6' name='L6'></a> 
<a id='L7' name='L7'></a># The tags file.
<a id='L8' name='L8'></a>TAGSF="$MC_TEST_EXTFS_INPUT"
<a id='L9' name='L9'></a> 
<a id='L10' name='L10'></a>. "$MC_TEST_EXTFS_CONFIG_SH"  # Gain access to $PERL.
<a id='L11' name='L11'></a> 
<a id='L12' name='L12'></a># ----------------------------------------------------------------------------
<a id='L13' name='L13'></a> 
<a id='L14' name='L14'></a>#
<a id='L15' name='L15'></a># Imitates 'rpm -qp --qf &lt;TEMPLATE&gt; &lt;PACKAGE_FILE&gt;'.
<a id='L16' name='L16'></a>#
<a id='L17' name='L17'></a># (It ignores &lt;PACKAGE_FILE&gt;, using our input instead.)
<a id='L18' name='L18'></a>#
<a id='L19' name='L19'></a># E.g.: given "Name: %{NAME} Ver: %{VERSION}",
<a id='L20' name='L20'></a># prints "Name: php-pear-Twig Ver: 1.0.0".
<a id='L21' name='L21'></a>#
<a id='L22' name='L22'></a>rpm_qf()
<a id='L23' name='L23'></a>{
<a id='L24' name='L24'></a>  $PERL -w -e '
<a id='L25' name='L25'></a>    $tagsf = $ARGV[0];
<a id='L26' name='L26'></a>    $tmplt = $ARGV[1];
<a id='L27' name='L27'></a> 
<a id='L28' name='L28'></a>    do $tagsf or die("$tagsf: $!");
<a id='L29' name='L29'></a>    $tmplt =~ s/\\n/\n/g;
<a id='L30' name='L30'></a>    $tmplt =~ s/%\{(.*?)\}/
<a id='L31' name='L31'></a>      (my $tag = $1) =~ s,^RPMTAG_,,;  # Tag names may be specified with or without this prefix.
<a id='L32' name='L32'></a>      exists $tags-&gt;{$tag} ? $tags-&gt;{$tag} : "(none)"
<a id='L33' name='L33'></a>    /eg;
<a id='L34' name='L34'></a>    print $tmplt;
<a id='L35' name='L35'></a>  ' \
<a id='L36' name='L36'></a>  "$TAGSF" "$1"
<a id='L37' name='L37'></a>}
<a id='L38' name='L38'></a>RPM_QUERY_FMT=rpm_qf  # Tell the helper to use it instead of the 'rpm' binary.
<a id='L39' name='L39'></a> 
<a id='L40' name='L40'></a># ----------------------------------------------------------------------------
<a id='L41' name='L41'></a> 
<a id='L42' name='L42'></a>#
<a id='L43' name='L43'></a># Overrides helper's.
<a id='L44' name='L44'></a>#
<a id='L45' name='L45'></a># @Mock
<a id='L46' name='L46'></a>#
<a id='L47' name='L47'></a>mcrpmfs_getDesription()
<a id='L48' name='L48'></a>{
<a id='L49' name='L49'></a>  rpm_qf "%{_INFO}"
<a id='L50' name='L50'></a>}
<a id='L51' name='L51'></a> 
<a id='L52' name='L52'></a># ----------------------------------------------------------------------------
</pre>
<hr />
<a id='BOTTOM' name='BOTTOM'></a>
<em class='comment'>/* <img class='icon' src='../icons/n_left.png' alt='[previous]' /><img class='icon' src='../icons/n_right.png' alt='[next]' /><img class='icon' src='../icons/n_first.png' alt='[first]' /><img class='icon' src='../icons/n_last.png' alt='[last]' /><a href='#TOP'><img class='icon' src='../icons/top.png' alt='[top]' /></a><img class='icon' src='../icons/n_bottom.png' alt='[bottom]' /><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a>&nbsp;<input type='text' readonly onfocus='this.select();' value='+52 tests/src/vfs/extfs/helpers-list/data/rpm.rewrite.sh'  /> */</em>
</body>
</html>
